#ifndef FTPMANAGER_H
#define FTPMANAGER_H

#include <QObject>
#include <QProgressBar>
#include <QFutureWatcher>

class FtpManager : public QObject
{
    Q_OBJECT
public:
    explicit FtpManager(QObject *parent = nullptr);
    ~FtpManager();

    // 上传文件
    void uploadFile(const QString& ftpServer, const QString& username, const QString& password,
                    const QString& localFilePath, const QString& remoteFilePath,
                    QProgressBar* progressBar = nullptr);

signals:
    void uploadFinished(bool success, const QString& errorMsg = "");

private slots:
    void onUploadFinished();

private:
    QFutureWatcher<bool>* m_watcher;
    QString m_errorMsg;
};

#endif // FTPMANAGER_H
